package com.itheima.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;
@RestController
public class ConsumerController {
    @Autowired
    private RestTemplate restTemplate;
    @GetMapping(value = "/nacos/consumer/{str}")
    public String getService(@PathVariable("str") String str) {
        return  restTemplate.getForObject("http://provider/nacos/service/"
                 + str, String.class);
    }
}